<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let address = '地址'
    let obj = {name: 'zs', age: 12, [address]: '航头'}
    const sex = '性别'
    // 对象中的[]的值不加引号会解析为变量
    // obj.sex = '男'
    obj[sex] = '男'
    console.log(obj);
    // {name: 'zs', age: 12 ,sex: '男', address: '航头'}
    // {name: 'zs', age: 12 ,性别: '男', 地址: '航头' }
  </script>
</body>
</html>